2.4 技术指标2:指数移动平均线 Technical Indicator 2: Exponential Moving Average (EMA)
Includes tsignal4, tsignal5, and tsignal6
包括交易信号 tsignal4, tsignal5, 以及 tsignal6
2.4.1 EMA简介 Intro- EMA:
Similar to the Simple Moving Average (SMA) which tends to smooth out the price variations, and the average prices are calculated by dropping the oldest data point and adding the latest one in a rolling manner. Specifically, an n-day Exponential Moving Average (EMA), or the n-day EMA prices refers to the exponential average of the stock prices (the model uses the adjusted close prices) for the past n consecutive trading days.
In contrast to the SMA, the Exponential Moving Average (EMA) use the smoothing factor \(\beta\) to assign a weight to each data point.This method ensures that more recent prices are given greater weight because of the exponential decay formula (The weights can be calculated in various ways, such as linear or exponential).
与简单移动平均线(SMA)类似,指数移动平均线(EMA)也旨在平滑价格波动,并通过滑动舍去最旧的数据点并添加最新数据点的方式来计算平均价格。n日指数移动平均线(EMA)或n日EMA价格指的是过去n个连续交易日的股票价格的指数平均值(模型使用调整收盘价)。
与SMA不同,指数移动平均线(EMA)使用平滑因子\(\beta\)为每个数据点分配权重,因为使用了指数衰减公式进行分配,近期的价格被赋予了更大的权重(权重可以通过多种方式计算,如线性或指数)。
Mathematically defined as: 数学上定义为:
\[\begin{aligned} \text{EMA}_t(P,n)&=\beta P_{t}+\beta(1-\beta)P_{t-1}+\beta(1-\beta)^{2}P_{t-2}+... \\ &= \beta P_{t}+(1-\beta)\text{EMA}_{t-1} \end{aligned}\]
where the smoothing coefficient \(\beta\) is usually defined as: 平滑因子\(\beta\)通常被定义为:
\[\beta=\frac{2}{n+1} \in (0;1)\]
The EMA uses the previous value of the EMA (\(\text{EMA}_{t-1}\)) in its calculation. This means the EMA includes all the price data within its current value. The smoothing coefficient ensures that the newest price data has the most impact on the moving averages and the oldest prices data has only a minimal impact.
The program uses the formula above to compute the Exponential Moving Average (EMA) values for all stocks in the model with various parameter settings, and creates appropriate related visualizations. The EMA-based daily trading signals will then be constructed from the subjectively set trading rules.
指数移动平均线(EMA)在其计算中包括了前一个EMA值(\(\text{EMA}_{t-1}\))。因此,EMA在其当前值中包含了了所有过去的价格数据(信息)。平滑系数的使用确保了最新的价格数据对移动平均值有最大的影响,而最旧的价格数据对平均值的影响也被最小化。
选股模型程序使用上述公式计算模型中所有股票的在多个不同的参数设定下的指数移动平均线(EMA)值,并创建相应的可视化图表。然后,根据主观设定的交易规则构建EMA日交易信号。
Enter the ticker/symbol in the search box for stock-specific results. Sort tool is available next to the variable names. 搜索框中输入股票代码可以过滤展示个股相关结果。点击变量名旁的箭头可进行排序。
Output 3.2.a: EMA Computations, latest 10 rows of data are shown.
图表 3.2.a: EMA 计算结果,展示最新的 10 行数据。
The program computed the EMA values for all stocks input in the model, with the parameter settings of \(n=5,8,13,20,50,200\). As an illustration, above table shows the computed EMA values and plots (end of section).
模型程序为输入的所有股票计算了EMA值,参数设定为\(n=5,8,13,20,50,200\)。作为示例,上表展示了计算的EMA值并创建了可视化图表(节末)。
2.4.2 交易信号与策略- EMA Trading signal(s) & strategies- EMA:
Typically, when the Exponential Moving Average (EMA) is on an upward trajectory and prices approach or slightly fall below the EMA, it suggests a potential buying opportunity. Conversely, when the EMA is declining and prices ascend towards or marginally exceed the EMA, it indicates a selling opportunity.
In essence, when a short-run EMA crosses from below to above a longer-run EMA is an indication to BUY. When a short-run EMA crosses from above to below a longer-run EMA is an indication to SELL.
通常情况下,当指数移动平均线(EMA)呈上升趋势,而价格接近或略低于EMA时,它提示着一个买入机会。相反,当EMA下降且价格向EMA靠近或略高于EMA时,则可视为一个卖出机会。
简而言之,当短期EMA从下方穿越至长期EMA的上方时,视为买入的信号。当短期EMA从上方穿越至长期EMA下方时,视为卖出的信号。
Moving averages are instrumental in identifying ‘support and resistance areas’. Given that the EMA responds more promptly to price changes than the Simple Moving Average (SMA), it can detect trends more swiftly. Thus, the EMA values and the ensuing trading signals are crucial for interpreting near-term price dynamics and identifying ‘support and resistance areas’.
An ascending EMA typically acts as a support level for price movements, whereas a descending EMA often serves as a resistance level. This principle underpins the strategy of buying close to a rising EMA and selling near a declining EMA.
移动平均线在提示“支撑和阻力区域”方面往往非常有效。鉴于EMA对价格变动的反应比简单移动平均线(SMA)更为敏感,能够比SMA更早地识别趋势变化;因此,EMA的值及其产生的交易信号在分析近期价格动向和“支撑与阻力区域”时变得更加重要。
上升通道中的EMA往往可以视为价格的支撑,而下降的EMA往往对价格行为构成阻力。这也增强了当价格接近上升EMA时买入、价格接近下降EMA时卖出的这一策略。
- EMA Trading Signal #4: \(\text{close price}>\text{EMA}(20)\) (Price relative to EMA) [
tsignal4]
- EMA Trading Signal #4: \(\text{close price}>\text{EMA}(20)\) (Price relative to EMA) [
- EMA 交易信号#4: \(\text{收盘价}>\text{EMA}(20)\)(价格相对于EMA)[
tsignal4]
- EMA 交易信号#4: \(\text{收盘价}>\text{EMA}(20)\)(价格相对于EMA)[
When the most recent closing price (the model uses the adjusted close prices) is above its EMA20 indicates a BUY signal, and vice versa for a SELL signal. We consider when \(\text{close price}>\text{EMA}(20)\), the stock is currently trading at a strength relative to its recent (over a month) price history, otherwise the stock is currently trading weakly.
当最近的收盘价(模型使用调整收盘价)高于其EMA20时,视为一个买入的信号,反之亦然表示一个卖出信号。我们认为当\(\text{收盘价}>\text{EMA}(20)\)时,股票当前价格相较于其近期(超过一个月)的历史价格呈现出强势表现,反之当前交易价格呈现为弱势。
- EMA Trading Signal #5: \(\text{EMA}(50)>\text{EMA}(200)\) (Hierarchical Moving Average Alignment) [
tsignal5]
- EMA Trading Signal #5: \(\text{EMA}(50)>\text{EMA}(200)\) (Hierarchical Moving Average Alignment) [
- EMA 交易信号#5: \(\text{EMA}(50)>\text{EMA}(200)\)(层次化移动平均对齐)[
tsignal5]
- EMA 交易信号#5: \(\text{EMA}(50)>\text{EMA}(200)\)(层次化移动平均对齐)[
Above mathematical expression is not completely accurate, where we believe when EMA50 crosses from below to above a 200-day Exponential Moving Average (EMA200) indicates the stock prices are stable and established an uptrend trend, i.e. a BUY signal. When the EMA50 crosses from above to below a EMA200 indicates a SELL signal.
Note, this is the EMA version of the most classical SMA trading strategies, commonly refers to as the ‘golden cross’ and ‘death cross’.
上述数学表达式不完全准确,我们认为当EMA50从下方穿越至200日指数移动平均线(EMA200)上方时,表示股价相对稳定且处于上升通道,即视为一个买入信号。当EMA50从上方穿越至EMA200下方时,视为一个卖出信号。这是最经典的SMA交易策略之一的EMA版本,通常被称为“金叉”和“死叉”。
- EMA Trading Signal #6: \(\text{EMA}(8)>\text{EMA}(13)\) & \(\text{EMA}(5)>\text{EMA}(8)\) (Short-to-medium term Moving Average Alignment) [
tsignal6]
- EMA Trading Signal #6: \(\text{EMA}(8)>\text{EMA}(13)\) & \(\text{EMA}(5)>\text{EMA}(8)\) (Short-to-medium term Moving Average Alignment) [
- EMA 交易信号#6: \(\text{EMA}(8)>\text{EMA}(13)\) 且 \(\text{EMA}(5)>\text{EMA}(8)\) (中短期移动平均对齐) [
tsignal6]
- EMA 交易信号#6: \(\text{EMA}(8)>\text{EMA}(13)\) 且 \(\text{EMA}(5)>\text{EMA}(8)\) (中短期移动平均对齐) [
Above mathematical expression is not completely accurate either, where we believe when the EMA8 crosses from below to above a 13-day Exponential Moving Average (EMA13) indicates the stock prices are in an upward trend for the medium term. If concurrently, the EMA5 crosses from below to above a EMA8, which indicates the stock prices are in an upward trend for the short-to-medium term; a BUY opportunity is signaled.
In contrast, when the EMA8 crosses from above to below an EMA13, and concurrently the EMA5 crosses from above to below the EMA8, indicates a SELL signal for the short-to-medium term.
Compare to the SMA version, this set of trading signals are more sensitive to price movements, as the EMA bears more weight on the more recent price variations, and the newest price data has the most impact.
上述数学表达式可能未能完全阐述所有细节。我们认为,当EMA8从下方穿过13天指数移动平均线(EMA13)时,表示股票价格在中期内呈上升趋势。同时,如果EMA5从下方穿过EMA8,则表明股票价格在短至中期内处于上升趋势,这被视为一个买入机会。相反,当EMA8从上方穿越至EMA13下方,且EMA5同时从上方穿越至EMA8下方时,可被视为短至中期的卖出信号。
与SMA相比,这一组EMA交易信号对价格的变动更为敏感。EMA更加注重近期的价格变化,因为其特性确保了最新的价格数据对平均数值具有最大的影响力。
2.4.3 EMA策略交易信号汇总 To summarize for EMA trading signals:
EMA-
tsignal4:
BUY: \(\text{close price}>\text{EMA}(20)\),
SELL: \(\text{close price}\leq \text{EMA}(20)\);EMA交易信号-
tsignal4:
买入: \(\text{收盘价}>\text{EMA}(20)\),
卖出: \(\text{收盘价}\leq \text{EMA}(20)\);EMA-
tsignal5:
BUY: \(\text{EMA}(50)\) cross from below to above \(\text{EMA}(200)\),
SELL: \(\text{EMA}(50)\) cross from above to below \(\text{EMA}(200)\),
HOLD: otherwise;EMA交易信号-
tsignal5:
买入: \(\text{EMA}(50)\) 从下方穿越至 \(\text{EMA}(200)\)上方,
卖出: \(\text{EMA}(50)\) 从上方穿越至 \(\text{EMA}(200)\)下方,
持有: 其他情况;EMA-
tsignal6:
BUY: \(\text{EMA}(8)\) cross from below to above a \(\text{EMA}(13)\) and \(\text{EMA}(5)\) cross from below to above a \(\text{EMA}(8)\),
SELL: \(\text{EMA}(8)\) cross from above to below a \(\text{EMA}(13)\) and \(\text{EMA}(5)\) cross from above to below a \(\text{EMA}(8)\),
HOLD: otherwise.EMA交易信号-
tsignal6:
买入: \(\text{EMA}(8)\) 从下方穿越至 \(\text{EMA}(13)\)上方并且 \(\text{EMA}(5)\) 从下方穿越至 \(\text{EMA}(8)\)上方,
卖出: \(\text{EMA}(8)\) 从上方穿越至 \(\text{EMA}(13)\)下方并且 \(\text{EMA}(5)\) 从上方穿越至 \(\text{EMA}(8)\)下方,
持有: 其他情况。
Enter the ticker/symbol in the search box for stock-specific results. Sort tool is available next to the variable names. 搜索框中输入股票代码可以过滤展示个股相关结果。点击变量名旁的箭头可进行排序。
Output 3.2.b: EMA trading signals, latest 10 rows of data are shown. Includes tsignal4, tsignal5, tsignal6, tsignal6a and tsignal6b.
图表3.2.b: EMA交易信号,展示最新的10行数据。包括tsignal4, tsignal5, tsignal6, tsignal6a和tsignal6b。
2.4.4 EMA总结 Summary- EMA:
The model adopts the same trading signal rules or indicator parameter settings for interpreting the Exponential Moving Average (EMA) as it does for the Simple Moving Average (SMA). However, the EMA is typically more responsive to price movements than the SMA. On one hand, this responsiveness allows the EMA to signal trends earlier than the SMA might. On the other hand, the EMA is likely to reflect more short-term changes (price fluctuations) than a corresponding SMA would.
All moving averages, including both the SMA and the EMA, are not crafted to pinpoint the precise bottoms and tops of price levels. Through the utilization of moving averages, the model aims to discern the general direction of market trends (upward, sideways/congested, downward), though analysts acknowledge that a delay in entry and exit points may occur due to the nature of the moving averages. Most critically, the EMA tends to have a shorter delay than the SMA for equivalent parameter settings.
模型采用了与简单移动平均线(SMA)相同的交易信号规则或指标参数设定来解读指数移动平均线(EMA)。然而,相较于SMA,EMA对价格变动通常更敏感。一方面,这种敏感性使EMA能比SMA更早地提示趋势走向。另一方面,与相对应的SMA相比,EMA可能会反映出更多的短期变化(价格波动)。
所有移动平均线,包括SMA和EMA,都不旨在精确识别价格水平的确切底部和顶部。通过使用移动平均线,模型旨在识别市场趋势的大致方向(向上、横向/盘整、向下),研究员们认识到由于移动平均线的数学特性,对于入场和出场时间点的识别可能会存在延迟。最关键的是,在相同的参数设置下,EMA比SMA的延迟更短。
Besides the SMA and EMA, several other moving averages are commonly utilized, such as the Weighted Moving Average (WMA), the Double Exponential Moving Average (DEMA), and the Triple Exponential Moving Average (TEMA). Most aim to smooth out price movements, making the technical indicators/trading signals less sensitive to short-term price fluctuations. Nonetheless, considering our investment needs to identify intra-day, short-term, and medium-to-longer-term equity investment opportunities, the model will primarily focus on the simple and exponential moving averages.
除了SMA和EMA之外,还有一些其他常用的移动平均线,如加权移动平均线(WMA)、双重指数移动平均线(DEMA)和三重指数移动平均线(TEMA)等。它们大多旨在平滑价格的变动,使技术指标/交易信号对短期股价波动的敏感度降低。然而,考虑到我们寻找和识别日内、短期和中长期股票投资机会的投资需求,此模型将主要关注简单和指数移动平均线。
The program is now constructed to generate daily trading signals given by the Exponential Moving Average (EMA) indicator values. The latest applied parameter settings and trading rules for the EMA-generated signals are summarized above.
Daily trading signals from the EMA indicators, include tsignal4, tsignal5 and tsignal6 (combined from tsignal6a and tsignal6b), for all stocks are generated; and the results (data tables and plots) for TSLA.US are shown above as illustrations, refer to the webapp for the complete data tables and plots/visualizations outputs.
根据指数移动平均线(EMA)指标值给出每日交易信号的模型程序现已构建完成。选股模型最新应用的指标参数设定和EMA策略生成的交易信号的相关分析和设定已在上述部分总结。
EMA指标的每日交易信号,包括tsignal4,tsignal5和tsignal6(由tsignal6a和tsignal6b组合而成),且已经为模型中所有的股票生成每日交易信号;并且以特斯拉(TSLA.US)的结果(数据表和图表)作为示例展示,完整图表可参阅webapp。
\(^*\) Whether the EMA indicator, or the trading signals tsignal4, tsignal5 and tsignal6 are effective in selecting stocks to construct a portfolio trading strategies with upsides, will be further analyzed by the model, and refer to \(\S 4.1\) 选取有效的技术指标(动态更新)Dynamic: Selecting Effective Technical Indicators below for more details.
\(^*\) EMA指标或策略交易信号tsignal4,tsignal5和tsignal6在组合交易策略中是否具备有效选择上升潜力股票的能力,将由选股模型进一步分析,详情参考\(\S 4.1\) 选取有效的技术指标(动态更新)Dynamic: Selecting Effective Technical Indicators。